<template>
  <div class="tools-header">
    <button class="openModalBtn" @click="isShowstudentModal">添加学生</button>
    <button @click="removeCheck" class="openModalBtn">选中删除</button>
    <div>
      <input
        type="text"
        name="keyword"
        class="keyword"
        placeholder="请输入姓名"
        v-model.trim="model"
      />
      <button type="button" class="searchBtn" @click="sousuo">搜索</button>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const porps = defineProps<{
  keyword: string
}>()
const model = ref(porps.keyword)
const emit = defineEmits<{
  (e: 'isShowstudentModal'): void
  (e: 'removeCheck'): void
  (e: 'sousuo'): void
}>()

const isShowstudentModal = () => {
  emit('isShowstudentModal')
}
const removeCheck = () => {
  emit('removeCheck')
}
const sousuo = () => {
  emit('sousuo')
}
</script>

<style lang="scss" scoped>
.tools-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;

  .openModalBtn {
    background-color: #4caf50;
    color: #fff;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 4px;

    &:hover {
      background-color: #45a049;
    }
  }

  div {
    display: flex;
    align-items: center;

    .keyword {
      padding: 8px;
      font-size: 16px;
      border: 1px solid #ccc;
      border-radius: 4px;
      margin-right: 10px;
    }

    .searchBtn {
      background-color: #2196f3;
      color: #fff;
      padding: 8px 16px;
      font-size: 16px;
      border-radius: 4px;

      &:hover {
        background-color: #1976d2;
      }
    }
  }
}
</style>
